--Stored Proc
--Select All Course Registrations based on input registration
CREATE PROCEDURE CourseRegistrationUINSearch
@UIN VARCHAR(20) = '%'
AS
BEGIN
DECLARE @SUIN VARCHAR(20) = '%'+@UIN+'%';
	SELECT 
		CregId,
		S.AutoId AS StudentAutoID,
		UIN,
		S.FirstName,
		S.LastName,
		C.AutoId AS CourseAutoId,
		C.CourseId,
		C.Name AS [Course]
	FROM 
		CourseRegistration CR INNER JOIN Student S  ON CR.StudentAutoId = S.AutoId
		INNER JOIN Course C ON C.AutoId = CR.CourseAutoId
	WHERE
	UIN  like @SUIN
	Order By UIN;
END;




